#include "process.h"
#include <unistd.h>
#include <string.h>

const char* lable = "|/-\\";
char bar[SIZE];
void processbar() {
    int lablen = strlen(lable);

    int cnt = 0;
    while(cnt <= TOP) {
        printf("[%-100s][%d%%]", bar, cnt);
        if(cnt >= TOP) {
            printf("[%s]", END);
        }
        else {
            printf("[%c]", lable[cnt % lablen]);
        }
        printf("\r");
        fflush(stdout);
        bar[cnt++] = BODY;
        if(cnt < TOP) {
            bar[cnt] = HEAD;
        }
        usleep(40000);
    }   
    printf("\n");
}
